Integrand size = 33, antiderivative size = 231 \[ \int \sqrt {a+b \cos (c+d x)} \left (A+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {2 a C \sqrt {a+b \cos (c+d x)} E\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )}{3 b d \sqrt {\frac {a+b \cos (c+d x)}{a+b}}}-\frac {2 \left (a^2 C-b^2 (3 A+C)\right ) \sqrt {\frac {a+b \cos (c+d x)}{a+b}} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),\frac {2 b}{a+b}\right )}{3 b d \sqrt {a+b \cos (c+d x)}}+\frac {2 a A \sqrt {\frac {a+b \cos (c+d x)}{a+b}} \operatorname {EllipticPi}\left (2,\frac {1}{2} (c+d x),\frac {2 b}{a+b}\right )}{d \sqrt {a+b \cos (c+d x)}}+\frac {2 C \sqrt {a+b \cos (c+d x)} \sin (c+d x)}{3 d} \]
[Out]
Time = 0.79 (sec) , antiderivative size = 231, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {3129, 3138, 2734, 2732, 3081, 2742, 2740, 2886, 2884} \[ \int \sqrt {a+b \cos (c+d x)} \left (A+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=-\frac {2 \left (a^2 C-b^2 (3 A+C)\right ) \sqrt {\frac {a+b \cos (c+d x)}{a+b}} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),\frac {2 b}{a+b}\right )}{3 b d \sqrt {a+b \cos (c+d x)}}+\frac {2 a A \sqrt {\frac {a+b \cos (c+d x)}{a+b}} \operatorname {EllipticPi}\left (2,\frac {1}{2} (c+d x),\frac {2 b}{a+b}\right )}{d \sqrt {a+b \cos (c+d x)}}+\frac {2 C \sin (c+d x) \sqrt {a+b \cos (c+d x)}}{3 d}+\frac {2 a C \sqrt {a+b \cos (c+d x)} E\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )}{3 b d \sqrt {\frac {a+b \cos (c+d x)}{a+b}}} \]
[In]
[Out]
Rule 2732
Rule 2734
Rule 2740
Rule 2742
Rule 2884
Rule 2886
Rule 3081
Rule 3129
Rule 3138
Rubi steps \begin{align*} \text {integral}& = \frac {2 C \sqrt {a+b \cos (c+d x)} \sin (c+d x)}{3 d}+\frac {2}{3} \int \frac {\left (\frac {3 a A}{2}+\frac {1}{2} b (3 A+C) \cos (c+d x)+\frac {1}{2} a C \cos ^2(c+d x)\right ) \sec (c+d x)}{\sqrt {a+b \cos (c+d x)}} \, dx \\ & = \frac {2 C \sqrt {a+b \cos (c+d x)} \sin (c+d x)}{3 d}-\frac {2 \int \frac {\left (-\frac {3}{2} a A b+\frac {1}{2} \left (a^2 C-b^2 (3 A+C)\right ) \cos (c+d x)\right ) \sec (c+d x)}{\sqrt {a+b \cos (c+d x)}} \, dx}{3 b}+\frac {(a C) \int \sqrt {a+b \cos (c+d x)} \, dx}{3 b} \\ & = \frac {2 C \sqrt {a+b \cos (c+d x)} \sin (c+d x)}{3 d}+(a A) \int \frac {\sec (c+d x)}{\sqrt {a+b \cos (c+d x)}} \, dx-\frac {\left (a^2 C-b^2 (3 A+C)\right ) \int \frac {1}{\sqrt {a+b \cos (c+d x)}} \, dx}{3 b}+\frac {\left (a C \sqrt {a+b \cos (c+d x)}\right ) \int \sqrt {\frac {a}{a+b}+\frac {b \cos (c+d x)}{a+b}} \, dx}{3 b \sqrt {\frac {a+b \cos (c+d x)}{a+b}}} \\ & = \frac {2 a C \sqrt {a+b \cos (c+d x)} E\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )}{3 b d \sqrt {\frac {a+b \cos (c+d x)}{a+b}}}+\frac {2 C \sqrt {a+b \cos (c+d x)} \sin (c+d x)}{3 d}+\frac {\left (a A \sqrt {\frac {a+b \cos (c+d x)}{a+b}}\right ) \int \frac {\sec (c+d x)}{\sqrt {\frac {a}{a+b}+\frac {b \cos (c+d x)}{a+b}}} \, dx}{\sqrt {a+b \cos (c+d x)}}-\frac {\left (\left (a^2 C-b^2 (3 A+C)\right ) \sqrt {\frac {a+b \cos (c+d x)}{a+b}}\right ) \int \frac {1}{\sqrt {\frac {a}{a+b}+\frac {b \cos (c+d x)}{a+b}}} \, dx}{3 b \sqrt {a+b \cos (c+d x)}} \\ & = \frac {2 a C \sqrt {a+b \cos (c+d x)} E\left (\frac {1}{2} (c+d x)|\frac {2 b}{a+b}\right )}{3 b d \sqrt {\frac {a+b \cos (c+d x)}{a+b}}}-\frac {2 \left (a^2 C-b^2 (3 A+C)\right ) \sqrt {\frac {a+b \cos (c+d x)}{a+b}} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),\frac {2 b}{a+b}\right )}{3 b d \sqrt {a+b \cos (c+d x)}}+\frac {2 a A \sqrt {\frac {a+b \cos (c+d x)}{a+b}} \operatorname {EllipticPi}\left (2,\frac {1}{2} (c+d x),\frac {2 b}{a+b}\right )}{d \sqrt {a+b \cos (c+d x)}}+\frac {2 C \sqrt {a+b \cos (c+d x)} \sin (c+d x)}{3 d} \\ \end{align*}
Result contains complex when optimal does not.
Time = 3.01 (sec) , antiderivative size = 371, normalized size of antiderivative = 1.61 \[ \int \sqrt {a+b \cos (c+d x)} \left (A+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {\frac {4 b (3 A+C) \sqrt {\frac {a+b \cos (c+d x)}{a+b}} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),\frac {2 b}{a+b}\right )}{\sqrt {a+b \cos (c+d x)}}+\frac {2 a (6 A+C) \sqrt {\frac {a+b \cos (c+d x)}{a+b}} \operatorname {EllipticPi}\left (2,\frac {1}{2} (c+d x),\frac {2 b}{a+b}\right )}{\sqrt {a+b \cos (c+d x)}}+\frac {2 i C \sqrt {-\frac {b (-1+\cos (c+d x))}{a+b}} \sqrt {\frac {b (1+\cos (c+d x))}{-a+b}} \csc (c+d x) \left (-2 a (a-b) E\left (i \text {arcsinh}\left (\sqrt {-\frac {1}{a+b}} \sqrt {a+b \cos (c+d x)}\right )|\frac {a+b}{a-b}\right )+b \left (-2 a \operatorname {EllipticF}\left (i \text {arcsinh}\left (\sqrt {-\frac {1}{a+b}} \sqrt {a+b \cos (c+d x)}\right ),\frac {a+b}{a-b}\right )+b \operatorname {EllipticPi}\left (\frac {a+b}{a},i \text {arcsinh}\left (\sqrt {-\frac {1}{a+b}} \sqrt {a+b \cos (c+d x)}\right ),\frac {a+b}{a-b}\right )\right )\right )}{b^2 \sqrt {-\frac {1}{a+b}}}+4 C \sqrt {a+b \cos (c+d x)} \sin (c+d x)}{6 d} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. \(600\) vs. \(2(298)=596\).
Time = 15.59 (sec) , antiderivative size = 601, normalized size of antiderivative = 2.60
method | result | size |
default | \(-\frac {2 \sqrt {\left (2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b \right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}\, \left (4 C \left (\cos ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b^{2}+3 A \,b^{2} \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, F\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right )-3 a A \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, \Pi \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), 2, \sqrt {-\frac {2 b}{a -b}}\right ) b +2 C \left (\cos ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a b -6 C \left (\cos ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b^{2}-C \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, F\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) a^{2}+C \,b^{2} \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, F\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right )+C \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, E\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) a^{2}-C \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, E\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) a b -2 C \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) a b +2 C \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) b^{2}\right )}{3 b \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b +\left (a +b \right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {-2 b \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b}\, d}\) | \(601\) |
parts | \(-\frac {2 A \sqrt {\left (2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b \right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}\, \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, \left (F\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) b -\Pi \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), 2, \sqrt {-\frac {2 b}{a -b}}\right ) a \right )}{\sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b +\left (a +b \right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {-2 b \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b}\, d}-\frac {2 C \sqrt {\left (2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b \right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}\, \left (4 \left (\cos ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b^{2}+2 \left (\cos ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a b -6 \left (\cos ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b^{2}-a^{2} \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, F\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right )+b^{2} \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, F\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right )+\sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, E\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) a^{2}-\sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {\frac {2 b \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a -b}{a -b}}\, E\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {-\frac {2 b}{a -b}}\right ) a b -2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) a b +2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) b^{2}\right )}{3 b \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b +\left (a +b \right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {-2 b \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b}\, d}\) | \(648\) |
[In]
[Out]
\[ \int \sqrt {a+b \cos (c+d x)} \left (A+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\int { {\left (C \cos \left (d x + c\right )^{2} + A\right )} \sqrt {b \cos \left (d x + c\right ) + a} \sec \left (d x + c\right ) \,d x } \]
[In]
[Out]
\[ \int \sqrt {a+b \cos (c+d x)} \left (A+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\int \left (A + C \cos ^{2}{\left (c + d x \right )}\right ) \sqrt {a + b \cos {\left (c + d x \right )}} \sec {\left (c + d x \right )}\, dx \]
[In]
[Out]
\[ \int \sqrt {a+b \cos (c+d x)} \left (A+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\int { {\left (C \cos \left (d x + c\right )^{2} + A\right )} \sqrt {b \cos \left (d x + c\right ) + a} \sec \left (d x + c\right ) \,d x } \]
[In]
[Out]
\[ \int \sqrt {a+b \cos (c+d x)} \left (A+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\int { {\left (C \cos \left (d x + c\right )^{2} + A\right )} \sqrt {b \cos \left (d x + c\right ) + a} \sec \left (d x + c\right ) \,d x } \]
[In]
[Out]
Timed out. \[ \int \sqrt {a+b \cos (c+d x)} \left (A+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\int \frac {\left (C\,{\cos \left (c+d\,x\right )}^2+A\right )\,\sqrt {a+b\,\cos \left (c+d\,x\right )}}{\cos \left (c+d\,x\right )} \,d x \]
[In]
[Out]